//引入路由相关的方法
import { createRouter, createWebHistory } from 'vue-router'

//引入自己的约束
import { MyRoutesTy } from '../../types/router'

//配置项 配置路由数组
const routes: MyRoutesTy = [
  /* 首页重定向 */
  {
    path: '/',
    redirect: '/home'
  },
  /* 首页 */
  {
    path: '/home',
    // component:  ,
    children: [
      {
        path: '',
        component: () => import('@/views/home/indexs.vue')
      }
    ]
  },
  {
    path: '/text',
    // component:  ,
    redirect: '/text/index',
    children: [
      {
        path: '/text/index',
        component: () => import('@/views/text/index.vue')
      }
    ]
  },
  {
    path: '/demo',
    component: () => import('@/views/demoVr/index')
  },

  /* 404页面 */
  {
    path: '/404',
    component: () => import('@/views/error/404.vue')
  },
  /* 404重定向 */
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  }
]

//创建路由实例
const router = createRouter({
  routes,
  history: createWebHistory()
})

//导出路由实例
export default router
